# -*- coding: utf-8 -*-
"""
@Time ： 2022/12/29 21:54
@Author ： PJC
"""
import yaml
from common.read_config import Environ
import os


def get_yaml(Environ='', filepath=''):
    Environ1 = os.path.abspath(os.path.dirname(os.path.dirname(__file__)) + Environ)  # 拼接定位到data文件夹
    filepath1 = os.path.abspath(os.path.dirname(os.path.dirname(__file__)) + r"/data") + "/" + filepath  # 拼接定位到data文件夹
    if Environ:
        with open(Environ1, "r", encoding="utf-8") as f:
            return yaml.load(f, Loader=yaml.FullLoader)
    if filepath:
        with open(filepath1, "r", encoding="utf-8") as f:
            return yaml.load(f, Loader=yaml.FullLoader)


if __name__ == '__main__':
    Env = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
    print(get_yaml(filepath='/usermanage/findalluserbypage.yaml'))
